#pragma once

#include <gtest/gtest.h>
#include <iostream>
#include <string>

using namespace std;

enum TOKEN_TYPE
{
  TYPE_NUMBER,
  TYPE_UNIT,
  TYPE_NEGATIVE
};

struct Token
{
  string        StringValue;
  int            Value;
  TOKEN_TYPE    Type;
};

class Parer {
public:
  bool AddOne(const string& value, const string& dic) {
    //add one char to value and == to dic
  }

  bool RemoveOne(const string& value, const string& dic) {
    //remove one char to value and == to dic
  }

  bool ReplaceOne(const string& value, const string& dic) {
    //replace one char to value and == to dic
  }

  int Distance(const string& value, const string& dic) {
    //make sure dic is longer than value.
    if (value == dic) return 0;

    if (value.size() - dic.size() == -1) {
      if (AddOne(value, dic))
        return 1;
    }

    if (value.size() - dic.size() == 1) {
      if (RemoveOne(value, dic))
        return 1;
    }

    if (ReplaceOne(value, dic))
      return 1;
    return 2;
  }

  vector<int> Parse(const string& value, std::vector<std::string>& dic)
  {
    vector<int> distance;
    distance.reserve(dic.size());

    for (const auto& item : dic) {
      distance.emplace_back(Distance(value, item));
    }
    return distance;
  }
};